<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <link rel="icon" href="https://xlzy520.cn/icons/lo.ico">
  <script src="../../node_modules/jquery/dist/jquery.min.js"></script>
  <title>旋转光球</title>
  <style>
    *, *::before, *::after {
      box-sizing: border-box;
    }

    html {
      background: radial-gradient(#222, #000);
      background-attachment: fixed;
    }

    body {
      position: absolute;
      top: calc(50% - 65px);
      left: calc(50% - 455px);
      margin: 0 auto;
      overflow: hidden;
      text-align: center;
      white-space: nowrap;
      font-size: 0;
    }

    .luminaire {
      position: relative;
      display: inline-block;
      width: 30px;
      height: 30px;
      margin: 50px;
      border-radius: 50%;
      background-color: #000;
      box-shadow: 0 0 40px 20px #fff, 0 0 100px 50px #0ff;
      transition: box-shadow 4s ease-out;
      animation: spin 16s linear infinite;
    }
    @keyframes spin {
      100% {
        transform: rotate(360deg);
      }
    }

    .luminaire:hover {
      cursor: pointer;
    }

    .luminaire::before, .luminaire::after {
      content: '';
      display: block;
      position: absolute;
      top: calc(50% - 10px);
      left: calc(50% - 10px);
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background-color: #fff;
      box-shadow: 0 0 40px 20px #fff, 0 0 100px 50px #ff0;
      opacity: 0;
      transition: opacity 8s, transform 8s;
    }

    .on {
      background-color: #fff;
      box-shadow: 0 0 80px 40px #fff, 0 0 200px 100px #f0f;
    }

    .on::before {
      transform: translateX(-100px);
      opacity: 1;
    }

    .on::after {
      transform: translateX(100px);
      opacity: 1;
    }
  </style>
</head>
<body>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<div class="luminaire"></div>
<script>
  $(function() {
    $('.luminaire:nth-child(2n)').addClass('on');
    $('.luminaire').on('click', function() {
      $(this).toggleClass('on');
    });
  });
</script>
</body>
</html>